package com.fyzk.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.tyjc.lottery.R;

/**
 * Created by qinkang on 2018/6/5.
 */

public class GenDanBounsAdapter extends BaseAdapter {
    private final Context context;
    private int selectPosition = -1;
    public GenDanBounsAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return 10;
    }

    public void setSelectPosition(int position){
        selectPosition = position;
        notifyDataSetChanged();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View view, ViewGroup viewGroup) {
        view = LayoutInflater.from(context).inflate(R.layout.item_gendan_bonus,null);
        TextView percent = view.findViewById(R.id.tv_percent);
        percent.setText(position+1+"%");

        if (position == selectPosition){
            percent.setSelected(true);
        }else {
            percent.setSelected(false);
        }

        return view;
    }
}
